Repository navigation
Share equal recoupling matrices between tree transformers - #630
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
lkdvos
left a comment
There was a problem hiding this comment.
I like this idea, however I was confused that this wasn't already the case. The problem is that the transform typically already caches the results, but in the latest versions I've added this convert(Matrix{T}, U) which creates an independent copy. It might be better to immediately fix the transform call to take in the desired eltype and cache that version, because effectively we will now be storing both a real and complex version in many cases (I think)
|
The |
|
Ah I see, but in that case it might make more sense to simply have the product transformations also cached, which should achieve the same thing? Let's keep the element type for future changes, since that touches quite a bit more code |
…type of the transformers Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Caching the product transforms would share the matrix between transformers that braid the same block in the same way, but not between blocks that differ only in their abelian charges, which have equal matrices under different keys; I don't know yet how the duplicates in the PEPS gradient split between the two. It would also add to the |
…he tree transformers Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
🚀 New features to boost your workflow:
|
lkdvos
left a comment
There was a problem hiding this comment.
Overall looks great, the only remark I have is that it's slightly inconsistent whether you put the T argument at the front or the end of the argument list. I don't have a strong preference on which one, I'd just keep it consistent
…return type of recouplingmatrix Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Made the scalar type the first argument throughout ( |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
CI failures seem unrelated, will merge |
Tree transformers for sectors with multiple fusion channels store one recoupling matrix per fusion tree block. These matrices only depend on the sectors, but the transformers did not share them: for product sectors such as
FermionParity ⊠ U1Irrep ⊠ SU2Irrep,product_transformassembles a new matrix on every call, blocks that differ only in their abelian charges have equal matrices under different cache keys, and the cached braids and transposes were converted to the scalar type of the transformer, which copies whenever the two differ.This caches the braids and transposes of fusion tree blocks in the scalar type of the transformers that use them, and returns their matrices through
recouplingmatrix, which gives back an equal matrix seen before, so that all transformers share one copy.cachesizeof a transformer leaves the shared matrices out, since the cache ofrecouplingmatrixcounts them.After one gradient of a D = 8 fermionic SU(2) PEPS (
FermionParity ⊠ U1Irrep ⊠ SU2Irrep), thetreebraidercache held 12.8 million recoupling matrices, of which 164338 were distinct: 2.21 GiB before, 0.085 GiB with this change. For all 480 permutations of a small tensor of the same kind, TensorKit's caches go from 89.5 to 76.6 MiB, and the transformers keep 7689 distinct matrices instead of a copy for each of their 681138 blocks when the same permutations are applied to three spaces. The D = 8 numbers were measured with the matrices shared at the level of the transformers instead, which then hold the same matrices as here.Reproducer
main:
this PR, at its first commit (76.6 MiB for the final form, measured with the same tensor and permutations):
🤖 Generated with Claude Code